<!doctype html>
<html lang="cn" class="fullscreen-bg">
    <head>
        <title></title>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    </head>
    <body>
        <div style="margin-top: 120px; text-align: center; font-size: 24px;">
            <img src="{$data.img}?id=1000" style="width: 90px;"/>
            <p>{$data.msg}</p>
        </div>
        <script src="/static/assets/js/jquery.min.js"></script>
        <script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.4.0.js"></script>
        <!-- <script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script> -->
        <script type="text/javascript">
            wx.config({
                //debug: true,
                appId: '{$signPackage.appId}',
                timestamp: {$signPackage.timestamp},
                nonceStr: '{$signPackage.nonceStr}',
                signature: '{$signPackage.signature}',
                jsApiList: [
                    'getLocation',
                ]
            });
            wx.ready(function () {
                wx.getLocation({
                    type: 'gcj02',
                    success: function (res) {
                        var latitude = res.latitude;
                        var longitude = res.longitude;
                        // alert('res:'+JSON.stringify(res));
                        $.ajax({
                            url:'/openlock.php',
                            data:{
                                'lat' : latitude,
                                'lng' : longitude,
                                'id' : "{$jspost['id']}",
                                'type' : "{$jspost['type']}",
                                'nickname' : "{$jspost['nickname']}",
                                'openid' : "{$jspost['openid']}"
                            },
                            type:'post',
                            dataType:'json',
                            success:function(data) {
                                if (data.code == 1) {
                                    $("img").attr("src",'/static/images/success.png');
                                    $("p").html('开门成功');
                                }else{
                                    $("img").attr("src",'/static/images/error.png');
                                    $("p").html(data.msg);
                                    // alert('data:'+JSON.stringify(data));
                                }
                            },
                            error: function (aaa) {
                                // alert('aaa:'+JSON.stringify(aaa));
                            }
                        });
                    },
                    fail: function (res) {
                        // alert('fail-res:'+JSON.stringify(res));
                    }
                });
            });
        </script>
    </body>
</html>